// 进度条
import NProgress from 'nprogress'
import 'nprogress/nprogress.css'
NProgress.configure({
  easing: 'ease',
  speed: 500,
  showSpinner: false
})

export default router => {
  router.beforeEach(async (to, from, next) => {
    if (to.meta.title) document.title = to.meta.title
    NProgress.start()
    next()
  })

  router.afterEach(() => {
    NProgress.done()
  })
}
